package com.ecoolex.union.pay.retailer.core;

import com.ecoolex.framework.cg.mybatis.MyBatisCodeGenerator;
import com.ecoolex.framework.cg.mybatis.core.ClassPluginInterface;
import com.ecoolex.framework.cg.mybatis.pojo.KeyValue;
import com.ecoolex.framework.cg.mybatis.support.DaoClassGenerate;
import com.ecoolex.framework.cg.mybatis.support.ManagerClassGenerate;

public class UnionPayRetailerMyBatisCodegen {

	@SuppressWarnings("unchecked")
	public static void main(String[] args) {
		// 配置项目路径
		MyBatisCodeGenerator generator = MyBatisCodeGenerator.create("src/main/java", "com.ecoolex.union.pay.retailer.core",
				KeyValue.create(ClassPluginInterface.TARGET_ENTITY, "com.ecoolex.union.pay.retailer.entity"),
				KeyValue.create(ClassPluginInterface.OVERRIDE, "false"));
		// 添加转移目录
		generator.addTransferPackage("com.ecoolex.union.pay.retailer.entity", "../union-pay-retailer-entity/");
		// 配置数据库
		generator.setJdbcConnection("com.mysql.jdbc.Driver",
				"jdbc:mysql://47.101.161.12:3306/template-union-pay-retailer?useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull",
				"root", "Kcxx1245!", KeyValue.create("nullCatalogMeansCurrent", "true"));
		// 配置插件
		// 扩展dao插件
		generator.addPlugin(DaoClassGenerate.class);
		// 业务逻辑插件
		generator.addPlugin(ManagerClassGenerate.class);

		// 配置表
		// 自动增长主键模版
		// generator.createDefaultTable("member", "Member", "id");
		// 非自增长主键，自设主键模版
		// generator.createDefaultTable("user_info", "UserInfo");
		// 视图
//		generator.createView("user", "User");
		//收单机构支付配置文件
		generator.createDefaultTable("payment_channel_config", "PaymentChannelConfig");
		//银联业务相关
		generator.createDefaultTable("union_pay_coupon", "UnionPayCoupon", "CouponId");
		generator.createDefaultTable("union_pay_popular_merchant", "UnionPayPopularMerchant","Id");
		generator.createDefaultTable("union_pay_popular_merchant_product", "UnionPayPopularMerchantProduct","Id");
		generator.createDefaultTable("union_pay_coupon_call_record", "UnionPayCouponCallRecord", "Id");
		generator.createDefaultTable("union_pay_coupon_verifying_consumption", "UnionPayCouponVerifyingConsumption", "Id");
		
		//银联自动领券配置
		generator.createDefaultTable("union_pay_auto_receive_coupon_config", "UnionPayAutoReceiveCouponConfig", "ConfigId");
		generator.generate();
	}
}
